import { Component, PropsWithChildren } from 'react'
import { View, Text, Image } from '@tarojs/components'
import Taro, { getCurrentInstance } from '@/newTaro';
import { navigateTo } from '@/utilsFun/vxNative';
import './index.scss'


export default class New extends Component<PropsWithChildren> {
  constructor(props) {
    super(props);

    this.state = {
      contents: [
        {
          title:'ASKLSJHDKLFHSKDJFNKKL',
          subTitle:'ASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKL'
        },
        {
          title:'ASKLSJHDKLFHSKDJFNKKL',
          subTitle:'ASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKLASKLSJHDKLFHSKDJFNKKL'
        }
      ],
    };
  }
  componentWillMount() {
    const title = this.$instance.router.params.title;
    if (title) {
      Taro.setNavigationBarTitle({
        title: decodeURIComponent(title)
      });
    }
  }

  componentDidMount() { }

  componentWillUnmount() { }

  componentDidShow() { }

  componentDidHide() { }

  $instance = getCurrentInstance();
  //
  nav2RichText=()=>{
    navigateTo('/pages/richText/index', {})
  }
  render() {
    const { contents } = this.state;
    return (
      <View className='index'>
        <View className='home_text_wrap'>
          {contents.map((item, index) => (
            <View key={index} className="text_item" onClick={this.nav2RichText}>
              <View key={index} className="text_top_item ellipsis">
                {item.title}
              </View>
              <View key={index} className="text_bottom_item">
                {item.subTitle}
              </View>             
            </View>
          ))}
        </View>
      </View>
    )
  }
}
